package com.baizhi.controller;


import org.springframework.web.bind.annotation.*;

/**
 * @RestController  定义当前的类为控制器  类中所有的方法
 *不需要加@Responsebody 就会以json的形式响应数据
 */
@RestController
@RequestMapping("test")
public class TestController {
    /**
     *
     * get  查询
     * post 添加
     * delete 删除
     *
     * put添加
     *
     * patch 修改
     *
     *
     *
     * @param name
     * @param password
     * @return
     */
    @GetMapping("testGet/{name}/{password}")
    public String  testGet(@PathVariable("name") String name, @PathVariable("password") String password){

        System.out.println(name);
        System.out.println(password);
        return name;
    }
    @PutMapping("testPut/{id}/{name}")
    public String  testPut(@PathVariable("id") String id, @PathVariable("name") String name){

        System.out.println(name);
        System.out.println(id);
        String s=id+name;
        return s;
    }

    @PostMapping("testPost/{id}/{name}")
    public String  testPost(@PathVariable("id") String id, @PathVariable("name") String name){

        System.out.println(name);
        System.out.println(id);
        String s=id+name;
        return s;
    }

    @DeleteMapping("testdelete/{id}")
    public String  testdelete(@PathVariable("id") String id){
        System.out.println(id);
        return id;
    }

    @PatchMapping("testpatch/{id}")
    public String  testpatch(@PathVariable("id") String id){
        System.out.println(id);
        return id;
    }



}
